import { Component, EventEmitter, Input, Output, OnInit, OnChanges } from '@angular/core';
import { Assembly, AssemblyStyles, AssemblyValidators } from '../../../fb-design.model'
import { SelectItem } from 'primeng/primeng';
@Component({
    selector: 'qk-text-attributes',
    templateUrl: 'qk-text-attributes.component.html',
    styleUrls: ['qk-text-attributes.component.scss'],
    providers: []
})
export class QkTextAttributes implements OnInit {
    @Input() assembly;
    @Output() onAttrChangedEmitter = new EventEmitter<Assembly>();

    ngOnInit() { }

    fontSize: SelectItem[];
    textAlign: SelectItem[];
    fontFamily: SelectItem[];
    yesNo: SelectItem[];
    fontDirection: SelectItem[];

    constructor() {
        /** 字体大小 */
        this.fontSize = [{ label: '12px', value: 12 }, { label: '14px', value: 14 }, { label: '16px', value: 16 }, { label: '18px', value: 18 }, { label: '24px', value: 24 }, { label: '36px', value: 36 }, { label: '48px', value: 48 }];
        /** 对齐方式 */
        this.textAlign = [{ label: '左对齐', value: "left" }, { label: '居中', value: "center" }, { label: "右对齐", value: "right" }];
        /** 字体  */
        this.fontFamily = [{ label: '微软雅黑', value: '"微软雅黑"' }, { label: '华文楷体', value: '"楷体","楷体_GB2312"' }, { label: '宋体', value: '"宋体"' }];
        /** 是否选项 */
        this.yesNo = [{ label: '否', value: '0' }, { label: '是', value: '1' }];
        /** 排列方向 */
        this.fontDirection = [{ label: '横向', value: 'transverse' }, { label: '竖向', value: 'vertical' }];
    }

    valueChange() {
        this.assembly.attributes.refreshStyle();
        this.onAttrChangedEmitter.emit(this.assembly);
    }
}